
#ifndef Lines_RenderableEntity_h
#define Lines_RenderableEntity_h

#include "Entity.h"
#include "Texture.h"
#include "Vector3.h"
#include "defs.h"

class RenderableEntity : public Entity
{
private:
    
protected:
    Texture* m_tTexture;
    Vector4 m_cColor;
    bool m_bFlipHorizontal;
    bool m_bFlipVertical;
    
    Vector2 m_vSize;
    Vector2 m_vStartUV;
    Vector2 m_vEndUV;
    
    void setup(const Texture* _tTexture);
    
    Vector2 m_vButtonOffset;
    Vector2 m_vButtonSize;
    
    bool m_bChangeColorWhenClicked;
    Vector4 m_cClickedColor;
    Vector4 m_cNormalColor;
    bool m_bPressed;

public:
    
    RenderableEntity();
    RenderableEntity(const Texture* _tTexture);
    RenderableEntity(const Texture* _tTexture, Vector2 _vPosition);
    RenderableEntity( std::string _sName, Vector2 _vPosition);
    ~RenderableEntity();    
    
    virtual void update();
    virtual void render();
    virtual void render(Vector2 _vOffset);
    virtual void renderShadow(Vector2 _vOffset = Vector2(2, -2));
    virtual void renderShadow(Vector4 _vColor, Vector2 _vOffset = Vector2(2, -2));
    
    //Getters & Setters
    void setStartUVs(Vector2 _Value) { m_vStartUV = _Value; }
    void setEndUVs(Vector2 _Value) { m_vEndUV = _Value; }
    void setFlipHorizontal(bool _bFlip) { m_bFlipHorizontal = _bFlip; }
    void setFlipVertical(bool _bFlip) { m_bFlipVertical = _bFlip; }
    void setColor(Vector4 _cColor) { m_cColor = _cColor; }
    void setAlpha(float _fAlpha) { m_cColor[3] = _fAlpha; }
    
    bool isFlipHorizontal() { return m_bFlipHorizontal; }
    bool isFlipVertical() { return m_bFlipVertical; }
    Vector4 getColor() { return m_cColor; }
    float getAlpha() { return m_cColor[3]; }
    Vector2 getSize() { return m_vSize; }
    
    //Button functionality
    void setupButton(Vector2 _vOffset, Vector2 _vSize);
    void setupButton(Vector2 _vButtonScale);
    bool isClicked();
    bool isPressed();
    
    void changeColorWhenClicked(bool _bChangeColor, Vector4 _cColor = COLOR_BLACK);
};

#endif
